package cn.jsj.finance.bank;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 修改银行帐信息
 * @author LI
 *
 */
 public class ModifyBankInfo extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	 public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("修改银行帐信息");
		 //新建银行帐信息对象
		 cn.jsj.pojo.TblBankAccount tba=new cn.jsj.pojo.TblBankAccount();
		 //赋值
		 tba.setBankAccBrief(request.getParameter("mbankBrief").trim());
		 tba.setBankAccId(Integer.parseInt(request.getParameter("mbankId").trim()));
		 tba.setBankAccTime(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("mbankTime").trim()));
		 tba.setIncomeMoney(Integer.parseInt(request.getParameter("mbankIncome").trim()));
		 tba.setPayoutMoney(Integer.parseInt(request.getParameter("mbankPayout").trim()));

		 // 调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("赋值完成--->"+tba.getBankAccBrief()+tba.getIncomeMoney()+tba.getBankAccId());

		 //更新数据
		 cn.jsj.dao.TblBankAccountDAO tbad=new cn.jsj.dao.TblBankAccountDAO();
		 int updateResult=tbad.updateBankInfo(tba);

		 //调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("更新结果---------->"+updateResult);
		 //输出流
		 java.io.PrintWriter out=response.getWriter();

		 //如果更新成功
		 if(updateResult==1){
			 out.println("{message:'更新成功！'}");
		 }else{
			 out.println("{message:'更新失败！'}");
		 }
		 out.flush();
		 out.close();
	}
}